
<%@ page import="com.gasstation.domain.GasSummary; java.text.DecimalFormat" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="Gas Summary" />
        <title>Gas Summary</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
        </div>
        <div class="body">
            <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:form action="index">
            <% Date date = (monthYear==null)?new Date():monthYear %>
            	<g:datePicker name="monthYear" value="${date}" precision="month"/> <g:submitButton name="showList" value="Go"/>
            
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                        	<th></th>
                        	<th>Regular</th>
                        	<th>Mid Grade</th>
                        	<th>Premium</th>
                        </tr>
                    </thead>
                    <tbody>
                    <%DecimalFormat df = new DecimalFormat("#.####"); %>
                        <tr class="odd">
                        	<td>Inventory (Gal/Pk)</td>
                            <td>${df.format(gasSummary.regularInventoryGallons)}</td>
                            <td>${df.format(gasSummary.midGradeInventoryGallons)}</td>
                            <td>${df.format(gasSummary.premiumInventoryGallons)}</td>
                        </tr>    
                        <tr class="even">
                        	<td>Inventory ($)</td>
                            <td>${df.format(gasSummary.regularInventoryCost)}</td>
                            <td>${df.format(gasSummary.midGradeInventoryCost)}</td>
                            <td>${df.format(gasSummary.premiumInventoryCost)}</td>
                        </tr>    
                        <tr class="odd">
                        	<td>Sales (Gal/Pk)</td>
                            <td>${df.format(gasSummary.regularTotalSales)}</td>
                            <td>${df.format(gasSummary.midGradeTotalSales)}</td>
                            <td>${df.format(gasSummary.premiumTotalSales)}</td>
                        </tr>    
                        <tr class="even">
                        	<td>Sales ($)</td>
                            <td>${df.format(gasSummary.regularSalesCost)}</td>
                            <td>${df.format(gasSummary.midGradeSalesCost)}</td>
                            <td>${df.format(gasSummary.premiumSalesCost)}</td>
                        </tr>    
                        <tr class="odd">
                        	<td>Inventory (Gal/Pk)</td>
                            <td>${df.format(gasSummary.regularInventoryGallons)}</td>
                            <td>${df.format(gasSummary.midGradeInventoryGallons)}</td>
                            <td>${df.format(gasSummary.premiumInventoryGallons)}</td>
                        </tr>    
                        <tr class="even">
                        	<td>Average Sales Price</td>
                            <td>${df.format(gasSummary.regularAvgSalesPrice)}</td>
                            <td>${df.format(gasSummary.midGradeAvgSalesPrice)}</td>
                            <td>${df.format(gasSummary.premiumAvgSalesPrice)}</td>
                        </tr>    
                        <tr class="odd">
                        	<td>Cost ($)</td>
                            <td>${df.format(gasSummary.regularCost)}</td>
                            <td>${df.format(gasSummary.midGradeCost)}</td>
                            <td>${df.format(gasSummary.premiumCost)}</td>
                        </tr>    
                        <tr class="even">
                        	<td>Average Cost</td>
                            <td>${df.format(gasSummary.regularAvgCost)}</td>
                            <td>${df.format(gasSummary.midGradeAvgCost)}</td>
                            <td>${df.format(gasSummary.premiumAvgCost)}</td>
                        </tr>    
                        <tr class="odd">
                        	<td>Gross Margin ($)</td>
                            <td>${df.format(gasSummary.regularGrossMargin)}</td>
                            <td>${df.format(gasSummary.midGradeGrossMargin)}</td>
                            <td>${df.format(gasSummary.premiumGrossMargin)}</td>
                        </tr>    
                        <tr class="even">
                        	<td>Gross Margin per Gal/Pk</td>
                            <td>${df.format(gasSummary.regularGrossMarginPerGallon)}</td>
                            <td>${df.format(gasSummary.midGradeGrossMarginPerGallon)}</td>
                            <td>${df.format(gasSummary.premiumGrossMarginPerGallon)}</td>
                        </tr>    
                    </tbody>
                </table>
            </div>
            </g:form>
        </div>
    </body>
</html>
